Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #244: introduction of derive_vars_cat() #252

Conversation

steventing12
Copy link
Collaborator

@steventing12 steventing12 commented Oct 22, 2024

feat: #247 Used call_derivation with derive_vars_crit_flag() to generate CRITy conditions and CRITyFL flags, superseding derive_var_bcvacritxfl()

Thank you for your Pull Request! We have developed this task checklist from the Development Process Guide to help with the final steps of the process. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the admiral family codebase remains robust and consistent.

Please check off each taskbox as an acknowledgment that you completed the task or check off that it is not relevant to your Pull Request. This checklist is part of the Github Action workflows and the Pull Request will not be merged into the main branch until you have checked off each task.

  • Place Closes #<insert_issue_number> into the beginning of your Pull Request Title (Use Edit button in top-right if you need to update).
  • Code is formatted according to the tidyverse style guide. Run styler::style_file() to style R and Rmd files.
  • Updated relevant unit tests or have written new unit tests, which should consider realistic data scenarios and edge cases, e.g. empty datasets, errors, boundary cases etc. - See Unit Test Guide
  • If you removed/replaced any function and/or function parameters, did you fully follow the deprecation guidance?
  • Update to all relevant roxygen headers and examples, including keywords and families. Refer to the [categorization of functions]
  • Run devtools::document() so all .Rd files in the man folder and the NAMESPACE file in the project root are updated appropriately.
  • Address any updates needed for vignettes and/or templates
  • Update NEWS.md under the header # admiralophtha (development version) if the changes pertain to a user-facing function (i.e. it has an @export tag) or documentation aimed at users (rather than developers)
  • Build admiralophtha site pkgdown::build_site() and check that all affected examples are displayed correctly and that all new functions occur on the "Reference" page.
  • Address or fix all lintr warnings and errors - lintr::lint_package().
  • Run R CMD check locally and address all errors and warnings - devtools::check().
  • Link the issue so that it closes after successful merging.
  • Address all merge conflicts and resolve appropriately.
  • Pat yourself on the back for a job well done! Much love to your accomplishment!

…placing look-up table with derive_vars_merged()

feat: #247 Used call_derivation with derive_vars_crit_flag() to generate CRITy conditions and CRITyFL flags, superseding derive_var_bcvacritxfl()
Copy link

Code Coverage

Package Line Rate Health
admiralophtha 100%
Summary 100% (133 / 133)

@manciniedoardo manciniedoardo changed the title feat: #244 Used derive_vars_cat() to derive AVALCA1N and AVALCAT1, re… Closes #244: introduction of derive_vars_cat() Oct 23, 2024
@manciniedoardo
Copy link
Collaborator

@steventing12 quoting your comment from the issue just so it's in the MR:

Used derive_vars_cat() to derive AVALCA1N and AVALCAT1, replacing look-up table with derive_vars_merged(). However, the input expression is still duplicating conditions for SBCVA and FBCVA as a combining expressions doesn't yield the same structure.

@manciniedoardo
Copy link
Collaborator

@steventing12 after reviewing and playing around, I agree that it's too complicated to programmatically duplicate the SBCVA rows to generate the FBCVA rows. Even if we managed to do it, the program would be unreadable. As such please could you go ahead with implementing the update using a simple lookup "table" like this one:

definition_bcva_avalcat <- exprs(
  ~PARAMCD,  ~condition,              ~AVALCA1N,    ~AVALCAT1,
  "SBCVA",   AVAL >= 0 & AVAL <= 3,   1000,          "< 20/800",
  "FBCVA",   AVAL >= 0 & AVAL <= 3,   1000,          "< 20/800",
  "SBCVA",   AVAL >= 4 & AVAL <= 8,   800,           "20/800",
  "FBCVA",   AVAL >= 4 & AVAL <= 8,   800,           "20/800",
  "SBCVA",   AVAL >= 9 & AVAL <= 13,  640,           "20/640",
  "FBCVA",   AVAL >= 9 & AVAL <= 13,  640,           "20/640",
  "SBCVA",   AVAL >= 14 & AVAL <= 18, 500,           "20/500",
  "FBCVA",   AVAL >= 14 & AVAL <= 18, 500,           "20/500",
  "SBCVA",   AVAL >= 19 & AVAL <= 23, 400,           "20/400",
  "FBCVA",   AVAL >= 19 & AVAL <= 23, 400,           "20/400",
  "SBCVA",   AVAL >= 24 & AVAL <= 28, 320,           "20/320",
  "FBCVA",   AVAL >= 24 & AVAL <= 28, 320,           "20/320",
  "SBCVA",   AVAL >= 29 & AVAL <= 33, 250,           "20/250",
  "FBCVA",   AVAL >= 29 & AVAL <= 33, 250,           "20/250",
  "SBCVA",   AVAL >= 34 & AVAL <= 38, 200,           "20/200",
  "FBCVA",   AVAL >= 34 & AVAL <= 38, 200,           "20/200",
  "SBCVA",   AVAL >= 39 & AVAL <= 43, 160,           "20/160",
  "FBCVA",   AVAL >= 39 & AVAL <= 43, 160,           "20/160",
  "SBCVA",   AVAL >= 44 & AVAL <= 48, 125,           "20/125",
  "FBCVA",   AVAL >= 44 & AVAL <= 48, 125,           "20/125",
  "SBCVA",   AVAL >= 49 & AVAL <= 53, 100,           "20/100",
  "FBCVA",   AVAL >= 49 & AVAL <= 53, 100,           "20/100",
  "SBCVA",   AVAL >= 54 & AVAL <= 58, 80,            "20/80",
  "FBCVA",   AVAL >= 54 & AVAL <= 58, 80,            "20/80",
  "SBCVA",   AVAL >= 59 & AVAL <= 63, 63,            "20/63",
  "FBCVA",   AVAL >= 59 & AVAL <= 63, 63,            "20/63",
  "SBCVA",   AVAL >= 64 & AVAL <= 68, 50,            "20/50",
  "FBCVA",   AVAL >= 64 & AVAL <= 68, 50,            "20/50",
  "SBCVA",   AVAL >= 69 & AVAL <= 73, 40,            "20/40",
  "FBCVA",   AVAL >= 69 & AVAL <= 73, 40,            "20/40",
  "SBCVA",   AVAL >= 74 & AVAL <= 78, 32,            "20/32",
  "FBCVA",   AVAL >= 74 & AVAL <= 78, 32,            "20/32",
  "SBCVA",   AVAL >= 79 & AVAL <= 83, 25,            "20/25",
  "FBCVA",   AVAL >= 79 & AVAL <= 83, 25,            "20/25",
  "SBCVA",   AVAL >= 84 & AVAL <= 88, 20,            "20/20",
  "FBCVA",   AVAL >= 84 & AVAL <= 88, 20,            "20/20",
  "SBCVA",   AVAL >= 89 & AVAL <= 93, 16,            "20/16",
  "FBCVA",   AVAL >= 89 & AVAL <= 93, 16,            "20/16",
  "SBCVA",   AVAL >= 94 & AVAL <= 97, 12,            "20/12",
  "FBCVA",   AVAL >= 94 & AVAL <= 97, 12,            "20/12",
  "SBCVA",   AVAL >= 98,               1,             "> 20/12",
  "FBCVA",   AVAL >= 98,               1,             "> 20/12"
)

maybe with a comment above it explaining this could also be moved to a separate file if so desired?

Please could you also reset the ADBCVA template to the current version in main before you make these updates, as I can see that in this PR at the moment you have work relating to #247.

Once the template is updated, please also update the ADBCVA vignette.

@manciniedoardo
Copy link
Collaborator

@steventing12 i forgot to mention - please ensure all checks pass and let me know of any queries. The PR checklist at the top of the page should be a good guide, and will for instance guide you on other tasks to execute like updating NEWS.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update ADBCVA vignette, template to use new {admiral} AVALCAT derivation function
2 participants